package cn.iocoder.yudao.module.enterprise.dal.mysql.report;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.enterprise.controller.admin.report.vo.ReportReductionPageReqVO;
import cn.iocoder.yudao.module.enterprise.dal.dataobject.report.ReportReductionDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 核算报告和减排信息关联 Mapper
 *
 * @author StevenShen
 */
@Mapper
public interface ReportReductionMapper extends BaseMapperX<ReportReductionDO> {

    default PageResult<ReportReductionDO> selectPage(ReportReductionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ReportReductionDO>()
                .eqIfPresent(ReportReductionDO::getReportId, reqVO.getReportId())
                .orderByDesc(ReportReductionDO::getId));
    }

    default List<ReportReductionDO> selectListByReportId(Long reportId) {
        return selectList(ReportReductionDO::getReportId, reportId);
    }

}
